<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>选项卡</title>
    <script src="https://unpkg.com/vue@next"></script>
    <style>
        #app {
            width: 500px;
            height: 500px;
        }

        .box {
            width: 500px;
            height: 500px;
        }

        .box_btn {
            display: flex;
            justify-content: space-around;
        }

        button {
            width: 200px;
            height: 50px;
        }

        .box_content {
            width: 100%;
            height: 450px;
            position: relative;
            background-color: turquoise;
        }

        .content_item {
            width: 100%;
            height: 100%;
            line-height: 450px;
            position: absolute;
            top: 0;
            left: 0;
            background-color: teal;
            text-align: center;
            font-size: 50px;
            display: none;
        }

        .active {
            display: block;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="box">
            <div class="box_btn">
                <button @click="handleClick(1)">1</button>
                <button @click="handleClick(2)">2</button>
                <button @click="handleClick(3)">3</button>
            </div>
            <div class="box_content">
                <div :class="{content_item:true,active:show==1?true:false}">1</div>
                <div :class="{content_item:true,active:show==2?true:false}">2</div>
                <div :class="{content_item:true,active:show==3?true:false}">3</div>
            </div>
        </div>
    </div>
</body>

<script>
    let vm = {
        data () {
            return {
                show: 1
            }
        },
        methods: {
            handleClick (index) {
                this.show = index
            }
        }
    }
    Vue.createApp(vm).mount('#app')
</script>

</html>